# 王磊的作业
x = 2
sum = 0
y = int(input("请输入需计算的数字："))
while x < y+2:
    j = 1
    for i in range(1, x):
        j = j * i
    sum = sum + j
    x += 1
print(sum)
